import { message, notification } from 'ant-design-vue';
import { h, type CSSProperties } from 'vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';

class Message {
  static getError(props: {
    mes: string;
    title?: string;
    time?: number;
    model?: string;
    styles?: CSSProperties;
  }) {
    const { mes, time, model, styles, title } = props;
    model == 'mode'
      ? notification.open({
          message: title,
          description: mes,
          icon: () => h(ExclamationCircleOutlined, { style: `color:#ff4d4f ` }),
          style: styles || {},
          duration: 2,
        })
      : message.error(mes, time);
  }
}

export default Message;
